﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SoldierFactory : ICharactorFactory {
    public Character CreateCharater<T>(WeaponType weaponType, Vector3 spawnPosition, int level) where T : Character, new()
    {
        Character character = new T();
        
        float  m_maxHP = 0;
        int m_level = 0;
        string  m_name = "";
        string m_iconSpriteName = "";
        float m_moveSpeed = 0;
        float m_critRate = 0;
        string m_prefabName = "";

        System.Type t = typeof(T);
        if (t == typeof(SoldierCaptain))
        {
            m_maxHP = 100;
            m_level = 3;
            m_name = "SoldierCaptain";
            m_iconSpriteName = "SoldierCaptain";
            m_moveSpeed = 3;
            m_critRate = 0.5f;
            m_prefabName = "SoldierCaptain";
        }
        else if (t == typeof(SoldierSergeant)){
            m_maxHP = 100;
            m_level = 3;
            m_name = "SoldierSergeant";
            m_iconSpriteName = "SoldierSergeant";
            m_moveSpeed = 3;
            m_critRate = 0.5f;
            m_prefabName = "SoldierSergeant";
        }
        else if(t== typeof(SoldierRookie))
        {
            m_maxHP = 100;
            m_level = 3;
            m_name = "SoldierRookie";
            m_iconSpriteName = "SoldierRookie";
            m_moveSpeed = 3;
            m_critRate = 0.5f;
            m_prefabName = "SoldierRookie";
        }
        else
        {
            Debug.LogError("此类型并非Soldier类型");
        }

        CharacterAtrr characterAttr = new SoldierAtrr(new SoldierAttrStrategy(), m_maxHP, m_name, m_iconSpriteName, m_moveSpeed, m_level, m_critRate, m_prefabName);
        character.Attr = characterAttr;
        return null;
    }

    
}
